﻿@*@model HotelManager.DataAccess.Model.RefinementModel*@
@model PagedList.IPagedList<HotelManager.DataAccess.Hotel>
<!--deal-->

@{
    int n = 0;
}

@foreach (var hotel in Model)
{
    string classname = "one-fourth";
    n++;
    if (n % 3 == 0)
    {
        classname = "one-fourth last";
    }
    <article class="@classname">
        <figure>
            <a href="@Url.Action("Details", "Hotel", new { id = hotel.Id })" title="">
                <img src="@Url.Content("~/Template/images/slider/img4.jpg")" alt="" width="270" height="152" />
            </a>
        </figure>
        <div class="details">
            <h1>
                @hotel.Name
                <span class="stars">
                    @for (int i = 0; i < hotel.Stars; i++)
                    {
                        <img src="@Url.Content("~/Template/images/ico/star.png")" alt="" />
                    }
                </span>
            </h1>
            <span class="address">User's rate</span>
            <span class="rating">
                @{
                    var rate = hotel.TotalPoints / hotel.RateCount;
                    if (rate > 0)
                    {
                    <span>@rate/10</span>
                    }
                    else
                    {
                    <span>N/A</span>
                    }
                }
            </span>
            <span class="price">Price per room per night from  
                <em>$@hotel.RoomTypes.OrderBy(x => x.Price).FirstOrDefault().Price
                </em>
            </span>
            <div class="description">
                <p>@hotel.ShortDescription</p>
            </div>
            <a href="@Url.Action("Details", "Hotel", new { id = hotel.Id })" title="Book now" class="gradient-button">Details</a>
        </div>
    </article>
}
<!--//deal-->

<!--bottom navigation-->
<div class="bottom-nav">
    <!--back up button-->
    <a href="#" class="scroll-to-top" title="Back up">Back up</a>
    <!--//back up button-->
    <!--pager-->
    <div class="pager">
        <span>
            @Ajax.ActionLink("First", "PagedResult", "Search", new { page = 1 }, new AjaxOptions { UpdateTargetId = "HotelList" })
        </span>
        @for (int i = 0; i < Model.PageCount; i++)
        {
            <span>
                @Ajax.ActionLink("" + (i + 1), "PagedResult", "Search", new { page = i + 1 }, new AjaxOptions { UpdateTargetId = "HotelList" })
            </span>
        }
        <span>
            @Ajax.ActionLink("Last", "PagedResult", "Search", new { page = Model.PageCount }, new AjaxOptions { UpdateTargetId = "HotelList" })
        </span>
    </div>
    <!--//pager-->
</div>
<!--//bottom navigation-->
